<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      for (var i = 1; i <= 10000000; i++) {
        var apple = Math.ceil(Math.random() * 200);
        var pear = Math.ceil(Math.random() * 200);
        var peach = Math.ceil(Math.random() * 200);
        if ((apple % 3 == 0) & (pear % 2 == 0)) {
          apple = apple / 3;
          pear = pear / 2;
          if (apple + pear + peach == 100) {
            if (apple * 3 + pear * 2 + peach === 200) {
              console.log(
                "apple" +
                  apple +
                  "个" +
                  apple * 3 +
                  "元" +
                  "+ pear" +
                  pear +
                  "个" +
                  pear * 2 +
                  "元" +
                  "+ peach" +
                  peach +
                  "个" +
                  peach +
                  "元" +
                  "=" +
                  (apple + pear + peach) +
                  "个" +
                  (apple * 3 + pear * 2 + peach) +
                  "元"
              );
              continue;
            }
          }
        }
      }

      // 28题
      // for (var apple = 0; apple <= 100; apple++) {
      //     for (var pears = 0; pears <= 100; pears++) {
      //         for (var peach = 0; peach <= 100; peach++) {
      //             if (3 * apple + 2 * pears + 1 * peach == 200 && apple + pears + peach == 100) {
      //                 console.log(apple, pears, peach);
      //             }
      //         }
      //     }
      // }
    </script>
  </head>
  <body></body>
</html>
